exports.resReply = (req,res,next) =>{
	const reply = ( error, data, pageInfo ) =>{
	    if( error ){
	        error.env = process.env.NODE_ENV;
	        console.error('error:',error);
	        res.end( JSON.stringify( {code:error.code, error:error.error, message:error.message} ) );
	    }
	    else{
	        res.set( { 'Content-Type': 'application/json' } );
	        res.end( JSON.stringify( {
	            error: null,
	            code: 0,
	            data: data,
	            pageInfo: pageInfo
	        }) );
	    }
	}
	res.reply = reply;
	next();
}